import {RouteRecordRaw,createRouter,createWebHashHistory,createWebHistory} from 'vue-router'
//定义路由规则对象集合
const routes:Array<RouteRecordRaw>=[
    {
        path:'/login',
        component:()=>import('@/views/Login.vue')
    },
    {
        path:'/',
        component:()=>import('@/views/Home.vue'),
        children:[
            {
                path:'users',
                component:()=>import('@/views/admin/Users.vue')
            },
            {
                path:'product',
                component:()=>import('@/views/admin/Product.vue')
            },
            {
                path:'productdetail/:id',
                component:()=>import('@/views/admin/ProductDetail.vue')
            },
            {
                path:'productUpdate',
                component:()=>import('@/views/admin/ProductUpdate.vue')
            }
        ]
    }
]
//定义router对象
const router=createRouter({
    routes:routes,
    //history:createWebHashHistory() //hash模式，
    history:createWebHistory() //history模式
})
export default router




